package com.tang.algorithm.binaryTree;

import java.util.HashMap;

/**
 * @author tlm
 * @version 1.0
 * @date 2020/8/1 18:10
 */
public class LeetCode965 {
    HashMap<Integer,Integer> hashMap = new HashMap<>();
    public boolean isUnivalTree(TreeNode root) {
        if (root == null){
            return false;
        }
        hashMap.put(root.val,null);
        isUnivalTree(root.left);
        isUnivalTree(root.right);
        if(hashMap.size()==1){
            return true;
        }else {
            return false;
        }
    }
}
